<template>

  <el-dialog title="选择需要批量应用的方案" :visible.sync="$attrs.visableIf" @close="handleCloseDialog" :close-on-click-modal="false" :close-on-press-escape="false" append-to-body width="850px">
    <div class="content-big">
      <div class="content-left">
        <div class="head-title">
          <el-checkbox v-model="checkedAll" @click="getCheckedAll">全选</el-checkbox>
          <el-input v-model="keyWord" placeholder="输入关键字" size="small" clearable @keyup.enter.native="handleQuery" suffix-icon="el-icon-search"/>
        </div>
        <div class="select-list">
          <el-checkbox-group v-model="form.type_id">
            <el-checkbox v-for="(item,index) in advertTypeList" :key="index" :label="Number(item.value)">
              <div class="title">{{ item.label }}</div>
              <div class="code">{{ item.value }}</div>
            </el-checkbox>
          </el-checkbox-group>
        </div>
      </div>
      <div class="content-right">
        <div class="right-title">应用记录</div>
        <ul>
          <li>
            <div class="name">民雨薇 <span>选择</span></div>
            <div class="type"><i class="round green"></i>已完成 <span>2024-01-12 14:28:03</span></div>
          </li>
          <li>
            <div class="name">民雨薇 <span>选择</span></div>
            <div class="type"><i class="round glay"></i>未完成 <span>2024-01-12 14:28:03</span></div>
          </li>
        </ul>
      </div>
    </div>


    <div class="footer-btn" slot="footer">
      <el-button @click="handleCloseDialog">取消</el-button>
      <el-button type="primary" @click="gotoNext">下一步选择企微号</el-button>
    </div>
    <applicationPage v-if="showApplicationPage" :visableIf.sync="showApplicationPage"></applicationPage>
  </el-dialog>
</template>

<script>


import {listUser} from "@/api/system/user";

export default {
  name: 'batchApplication',
  components: {
    'applicationPage': () => import('./applicationPage.vue'),
  },
  data() {
    return {
      // 查询参数
      input3: null,//群查找
      radio: null,//
      keyWord: null,//关键词
      form: {
        type_id: [],
      },
      showApplicationPage: false,
      checkedAll: false,//是否全选
      tableDataList: [],
      total: 8, // 表格的总条数
      advertTypeList: [
        {
          value: 1,
          label: '企划方案',
        },
        {
          value: 2,
          label: '放假时间方案',
        },
        {
          value: 3,
          label: '放假时间方案',
        },
      ],
      showSelectSmartTags: false,//智能标签
      tableHeight: 600,
      dateRange1: [],
    }
  },
  created() {
    this.tableDataList = [];
    for (let i = 0; i < 10; i++) {
      let obj = {
        name: '小红',
        status: '离线',

      }
      this.tableDataList.push(obj);
    }
  },
  mounted() {
  },
  watch: {},
  methods: {
    getCheckedAll() {
      //是否全选
    },

    /** 查询用户列表 */
    getList() {
      this.loading = true;
      listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
          this.userList = response.rows;
          this.total = response.total;
          this.loading = false;
        }
      );
    },
    gotoNext() {
      this.showApplicationPage = true;
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.queryParams.deptId = undefined;
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(val) {
      this.multipleSelection = [];
      if (val && val.length > 0) {
        val.forEach((item) => {
          this.multipleSelection.push(item.id);
        })
        console.log('multipleSelection', this.multipleSelection);
      }
    },
    handleCloseDialog() {
      this.$emit('update:visableIf', false);
      this.$emit('handleQuery');
    }
  }
}
</script>

<style scoped lang="scss">
.footer-btn {
  position: relative;


}

.el-checkbox-group {
  display: flex;
  flex-wrap: wrap;

  .el-checkbox {
    padding: 8px 12px;
    border: 1px solid #e9e9e9;
    display: flex;
    width: calc(50% - 10px) !important;
    margin: 0px 5px;
    box-sizing: border-box;

    .title {
      white-space: normal;
      color: #888 !important;
    }

    .code {
      color: #888;
    }

    ::v-deep .el-checkbox__inner {
      margin-top: 4px;
    }
  }
}


.content-big {
  display: flex;
  height: 100%;

  .content-left {
    width: 500px;
    background: #fff;
    border-right: 1px solid #eee;


  }

  .content-right {
    flex: 1;

    .right-title {
      height: 40px;
      line-height: 40px;
      font-weight: bold;
      margin-left: 16px;
    }

    ul {
      li {
        display: flex;
        justify-content: space-between;
        flex-direction: column;
        background: #f7f7f7;
        margin-bottom: 10px;
        margin: 5px 15px;
        padding: 10px;
        color: rgba(0, 0, 0, .85);
        border-radius: 5px;

        .name {
          display: flex;
          justify-content: space-between;
          margin-bottom: 15px;

          span {
            color: #2d8cf0;
          }
        }

        .type {
          display: flex;
          justify-content: space-between;
          position: relative;
          padding-left: 10px;

          span {
            color: rgba(0, 0, 0, .45);
          }

          i {
            font-size: 10px;
            width: 6px;
            height: 6px;
            border-radius: 50%;
            position: absolute;
            left: 0px;
            top: 6px;

            &.green {
              background: #52c41a;
            }

            &.glay {
              background: #c1c2c5;
            }
          }
        }
      }
    }
  }
}


.el-form {
  padding: 0px 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;

  .el-input {
    width: 150px;
    height: 32px;
    line-height: 32px;
    margin-right: 10px;
  }

  ::v-deep .el-input__inner {
    height: 32px;
    line-height: 32px;
  }

  .el-form-item {
    margin-bottom: 20px;
    margin-right: 0px;
    display: flex;


    .select-left {
      width: 132px;
      margin-right: 5px;

    }

    .select-right {
      width: 224px !important;
    }
  }

  ::v-deep .el-radio-group {
    .el-radio__input {
      display: none;
    }

    .el-radio {
      margin-right: 0px;
    }

    .el-radio__label {
      height: 32px;
      display: flex;
      justify-items: center;
      border: 1px solid #eee;
      padding: 0px 20px;
      align-items: center;
      border-radius: 5px;
    }
  }
}

::v-deep .el-dialog__body {
  overflow-y: auto;
  height: 600px;
  padding: 0px;
}

.el-checkbox-group {
  margin-top: 20px;

  .el-checkbox {
    margin-bottom: 12px;
    width: 150px;
  }
}

.head-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid #e9e9e9;
  background: #f7f7f7;

  .el-input {
    width: 200px;
  }
}

</style>
